#pragma once
#include "IOCPCore.h"

static CRITICAL_SECTION g_queueCS;
DWORD WINAPI sendDataThread(LPVOID pParam);

typedef struct _SockList
{
	int	sid;
	PerSockContext* pSockContent;
	_SockList* next;

	_SockList(){
		sid = 0;
		pSockContent = NULL;
		next = NULL;
	}

}SockList;

class hqServer :
	public IOCPCore
{
public:
	hqServer();
	virtual ~hqServer();

public:
	char* m_theHost;
	int m_matchesNum;
	int m_filtersNum;
	unsigned long m_cacheTimeOut;
	char* pPicFormats;
	int index_no;
	void onConnect(PerSockContext* pSockContext, sockaddr_in* client);
	void onConnectRefused(PerSockContext* pSockContext);
	void onConnectBroken(PerSockContext* pSockContext);
	int onRecv(PerSockContext* pSockContext, DWORD recvdBytes);
	int onDisconnect(PerSockContext* pSockContext);
	void onExceptionClose(PerSockContext* pSockContext);
	void appendData(char* pData, int len);
	//////////////////////////////////////////////////////////////////////////
	// helper functions
	//////////////////////////////////////////////////////////////////////////
private:

};

